// Licensed to Elasticsearch B.V under one or more agreements.
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information.
//
// ███╗   ██╗ ██████╗ ████████╗██╗ ██████╗███████╗
// ████╗  ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝
// ██╔██╗ ██║██║   ██║   ██║   ██║██║     █████╗
// ██║╚██╗██║██║   ██║   ██║   ██║██║     ██╔══╝
// ██║ ╚████║╚██████╔╝   ██║   ██║╚██████╗███████╗
// ╚═╝  ╚═══╝ ╚═════╝    ╚═╝   ╚═╝ ╚═════╝╚══════╝
// ------------------------------------------------
//
// This file is automatically generated.
// Please do not edit these files manually.
//
// ------------------------------------------------

using Elastic.Transport;
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Text.Json;
using System.Text.Json.Serialization;

#nullable restore
namespace Elastic.Clients.Elasticsearch.Ml
{
	public sealed class MlGetInfluencersRequestParameters : RequestParameters<MlGetInfluencersRequestParameters>
	{
		[JsonIgnore]
		public bool? Desc { get => Q<bool?>("desc"); set => Q("desc", value); }

		[JsonIgnore]
		public DateTimeOffset? End { get => Q<DateTimeOffset?>("end"); set => Q("end", value); }

		[JsonIgnore]
		public bool? ExcludeInterim { get => Q<bool?>("exclude_interim"); set => Q("exclude_interim", value); }

		[JsonIgnore]
		public double? InfluencerScore { get => Q<double?>("influencer_score"); set => Q("influencer_score", value); }

		[JsonIgnore]
		public int? From { get => Q<int?>("from"); set => Q("from", value); }

		[JsonIgnore]
		public int? Size { get => Q<int?>("size"); set => Q("size", value); }

		[JsonIgnore]
		public Elastic.Clients.Elasticsearch.Field? Sort { get => Q<Elastic.Clients.Elasticsearch.Field?>("sort"); set => Q("sort", value); }

		[JsonIgnore]
		public DateTimeOffset? Start { get => Q<DateTimeOffset?>("start"); set => Q("start", value); }
	}

	public sealed partial class MlGetInfluencersRequest : PlainRequestBase<MlGetInfluencersRequestParameters>
	{
		public MlGetInfluencersRequest(Elastic.Clients.Elasticsearch.Id job_id) : base(r => r.Required("job_id", job_id))
		{
		}

		internal override ApiUrls ApiUrls => ApiUrlsLookups.MachineLearningGetInfluencers;
		protected override HttpMethod HttpMethod => HttpMethod.POST;
		protected override bool SupportsBody => true;
		[JsonIgnore]
		public bool? Desc { get => Q<bool?>("desc"); set => Q("desc", value); }

		[JsonIgnore]
		public DateTimeOffset? End { get => Q<DateTimeOffset?>("end"); set => Q("end", value); }

		[JsonIgnore]
		public bool? ExcludeInterim { get => Q<bool?>("exclude_interim"); set => Q("exclude_interim", value); }

		[JsonIgnore]
		public double? InfluencerScore { get => Q<double?>("influencer_score"); set => Q("influencer_score", value); }

		[JsonIgnore]
		public int? From { get => Q<int?>("from"); set => Q("from", value); }

		[JsonIgnore]
		public int? Size { get => Q<int?>("size"); set => Q("size", value); }

		[JsonIgnore]
		public Elastic.Clients.Elasticsearch.Field? Sort { get => Q<Elastic.Clients.Elasticsearch.Field?>("sort"); set => Q("sort", value); }

		[JsonIgnore]
		public DateTimeOffset? Start { get => Q<DateTimeOffset?>("start"); set => Q("start", value); }

		[JsonInclude]
		[JsonPropertyName("page")]
		public Elastic.Clients.Elasticsearch.Ml.Page? Page { get; set; }
	}

	public sealed partial class MlGetInfluencersRequestDescriptor<TDocument> : RequestDescriptorBase<MlGetInfluencersRequestDescriptor<TDocument>, MlGetInfluencersRequestParameters>
	{
		internal MlGetInfluencersRequestDescriptor(Action<MlGetInfluencersRequestDescriptor<TDocument>> configure) => configure.Invoke(this);
		public MlGetInfluencersRequestDescriptor(Elastic.Clients.Elasticsearch.Id job_id) : base(r => r.Required("job_id", job_id))
		{
		}

		internal MlGetInfluencersRequestDescriptor()
		{
		}

		internal override ApiUrls ApiUrls => ApiUrlsLookups.MachineLearningGetInfluencers;
		protected override HttpMethod HttpMethod => HttpMethod.POST;
		protected override bool SupportsBody => true;
		public MlGetInfluencersRequestDescriptor<TDocument> Desc(bool? desc = true) => Qs("desc", desc);
		public MlGetInfluencersRequestDescriptor<TDocument> End(DateTimeOffset? end) => Qs("end", end);
		public MlGetInfluencersRequestDescriptor<TDocument> ExcludeInterim(bool? excludeInterim = true) => Qs("exclude_interim", excludeInterim);
		public MlGetInfluencersRequestDescriptor<TDocument> From(int? from) => Qs("from", from);
		public MlGetInfluencersRequestDescriptor<TDocument> InfluencerScore(double? influencerScore) => Qs("influencer_score", influencerScore);
		public MlGetInfluencersRequestDescriptor<TDocument> Size(int? size) => Qs("size", size);
		public MlGetInfluencersRequestDescriptor<TDocument> Sort(Elastic.Clients.Elasticsearch.Field? sort) => Qs("sort", sort);
		public MlGetInfluencersRequestDescriptor<TDocument> Start(DateTimeOffset? start) => Qs("start", start);
		public MlGetInfluencersRequestDescriptor<TDocument> JobId(Elastic.Clients.Elasticsearch.Id job_id)
		{
			RouteValues.Required("job_id", job_id);
			return Self;
		}

		private Elastic.Clients.Elasticsearch.Ml.Page? PageValue { get; set; }

		private PageDescriptor PageDescriptor { get; set; }

		private Action<PageDescriptor> PageDescriptorAction { get; set; }

		public MlGetInfluencersRequestDescriptor<TDocument> Page(Elastic.Clients.Elasticsearch.Ml.Page? page)
		{
			PageDescriptor = null;
			PageDescriptorAction = null;
			PageValue = page;
			return Self;
		}

		public MlGetInfluencersRequestDescriptor<TDocument> Page(PageDescriptor descriptor)
		{
			PageValue = null;
			PageDescriptorAction = null;
			PageDescriptor = descriptor;
			return Self;
		}

		public MlGetInfluencersRequestDescriptor<TDocument> Page(Action<PageDescriptor> configure)
		{
			PageValue = null;
			PageDescriptor = null;
			PageDescriptorAction = configure;
			return Self;
		}

		protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings)
		{
			writer.WriteStartObject();
			if (PageDescriptor is not null)
			{
				writer.WritePropertyName("page");
				JsonSerializer.Serialize(writer, PageDescriptor, options);
			}
			else if (PageDescriptorAction is not null)
			{
				writer.WritePropertyName("page");
				JsonSerializer.Serialize(writer, new PageDescriptor(PageDescriptorAction), options);
			}
			else if (PageValue is not null)
			{
				writer.WritePropertyName("page");
				JsonSerializer.Serialize(writer, PageValue, options);
			}

			writer.WriteEndObject();
		}
	}

	public sealed partial class MlGetInfluencersRequestDescriptor : RequestDescriptorBase<MlGetInfluencersRequestDescriptor, MlGetInfluencersRequestParameters>
	{
		internal MlGetInfluencersRequestDescriptor(Action<MlGetInfluencersRequestDescriptor> configure) => configure.Invoke(this);
		public MlGetInfluencersRequestDescriptor(Elastic.Clients.Elasticsearch.Id job_id) : base(r => r.Required("job_id", job_id))
		{
		}

		internal MlGetInfluencersRequestDescriptor()
		{
		}

		internal override ApiUrls ApiUrls => ApiUrlsLookups.MachineLearningGetInfluencers;
		protected override HttpMethod HttpMethod => HttpMethod.POST;
		protected override bool SupportsBody => true;
		public MlGetInfluencersRequestDescriptor Desc(bool? desc = true) => Qs("desc", desc);
		public MlGetInfluencersRequestDescriptor End(DateTimeOffset? end) => Qs("end", end);
		public MlGetInfluencersRequestDescriptor ExcludeInterim(bool? excludeInterim = true) => Qs("exclude_interim", excludeInterim);
		public MlGetInfluencersRequestDescriptor From(int? from) => Qs("from", from);
		public MlGetInfluencersRequestDescriptor InfluencerScore(double? influencerScore) => Qs("influencer_score", influencerScore);
		public MlGetInfluencersRequestDescriptor Size(int? size) => Qs("size", size);
		public MlGetInfluencersRequestDescriptor Sort(Elastic.Clients.Elasticsearch.Field? sort) => Qs("sort", sort);
		public MlGetInfluencersRequestDescriptor Start(DateTimeOffset? start) => Qs("start", start);
		public MlGetInfluencersRequestDescriptor JobId(Elastic.Clients.Elasticsearch.Id job_id)
		{
			RouteValues.Required("job_id", job_id);
			return Self;
		}

		private Elastic.Clients.Elasticsearch.Ml.Page? PageValue { get; set; }

		private PageDescriptor PageDescriptor { get; set; }

		private Action<PageDescriptor> PageDescriptorAction { get; set; }

		public MlGetInfluencersRequestDescriptor Page(Elastic.Clients.Elasticsearch.Ml.Page? page)
		{
			PageDescriptor = null;
			PageDescriptorAction = null;
			PageValue = page;
			return Self;
		}

		public MlGetInfluencersRequestDescriptor Page(PageDescriptor descriptor)
		{
			PageValue = null;
			PageDescriptorAction = null;
			PageDescriptor = descriptor;
			return Self;
		}

		public MlGetInfluencersRequestDescriptor Page(Action<PageDescriptor> configure)
		{
			PageValue = null;
			PageDescriptor = null;
			PageDescriptorAction = configure;
			return Self;
		}

		protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings)
		{
			writer.WriteStartObject();
			if (PageDescriptor is not null)
			{
				writer.WritePropertyName("page");
				JsonSerializer.Serialize(writer, PageDescriptor, options);
			}
			else if (PageDescriptorAction is not null)
			{
				writer.WritePropertyName("page");
				JsonSerializer.Serialize(writer, new PageDescriptor(PageDescriptorAction), options);
			}
			else if (PageValue is not null)
			{
				writer.WritePropertyName("page");
				JsonSerializer.Serialize(writer, PageValue, options);
			}

			writer.WriteEndObject();
		}
	}
}